﻿@model DLM.Web.ViewModel.AttendPageView
@{
    ViewBag.Title = "都来米-参加活动";
    Layout = "~/Views/Shared/_Master.cshtml";
    
}
<script type="text/javascript">
    $(document).ready(function () {


        $("#btnAttend").click(function () {
            if ($('input[type="checkbox"][name="chkAgree"]').attr("checked")) {

            } else {
                ShowDialogMessage('warn', "查看并同意《报名须知》才能参加活动！");
                return false;
            }
            $('input[type="checkbox"][name="chkAgree"]').change(function () {

            });

        });

        $('#open_service').click(function () {

            $("#service_dialog").dialog(
	        {
	            modal: true,
	            buttons: {
	                拒绝: function () {
	                    $('input[type="checkbox"][name="chkAgree"]').removeAttr("checked");
	                    $("#btnAttend").attr("disabled", "disabled");
	                    $(this).dialog("close");
	                },
	                同意: function () {
	                    $('input[type="checkbox"][name="chkAgree"]').attr("checked", "checked");
	                    $("#btnAttend").removeAttr("disabled");
	                    $(this).dialog("close");
	                }

	            },
	            width: 900,
	            height: 600
	        }
	        );
            $("#service_dialog").load("/Party/ShowAttendNotice");
            return false;
        });


        $("#edit").click(function () {


            $("#divUserEdit").dialog(
	            {
	                modal: true,
	                buttons: {
	                    关闭: function () {

	                        $(this).dialog("close");
	                        window.location.reload(true);
	                    }

	                },
	                width: 650
	            }
	            );
            $("#divUserInfo").load("/User/UserEdit/@Model.User.UserID")
            return false;

        });

    });




</script>
<!--弹出提示框html内容-->
<div id="service_dialog" style="display: none;" title="都来米活动参加须知">
</div>
<!--弹出提示框html内容已结束-->
<div id="divUserEdit" style="display: none;" title="会员信息编辑">
    <div id="divUserInfo">
    </div>
</div>
@using (Html.BeginForm("Attend", "Party", new { partyID = Model.Party.PartyID, userID = Model.User.UserID }, FormMethod.Post))
{ 
   
    <div class="main">
        <div class="main_tab">
            <div class="main_tab_title">
                <h3>
                    参加活动
                </h3>
                <div class="more_operate">
                    小三角</div>
            </div>
            <div class="main_tab_box">
                <div class="tr clearfix">
                    <label class="lb">
                        <s></s>&nbsp;</label>
                    <div class="info">
                        @Html.ValidationSummary(true, "报名失败，请重试！")
                    </div>
                </div>
                <div class="act_list">
                    <h4>
                        活动主题：
                        @Model.Party.Subject</h4>
                    <div class="updates">
                        <div class="tr">
                            <div class="album">
                                @if (!string.IsNullOrEmpty(Model.User.Photo) && Model.User.Photo != "none_75_75.png")
                                {
                                    <a>
                                        <img src="@Url.Content("~/Files/Photos/" + Model.User.UserID + "/Title/" + Model.User.Photo)" /></a>
                                }
                                else
                                {
                                    <span>请点击屏幕右边编辑按钮更新照片</span>
@*     <a>
                                        <img src="@Url.Content("~/Content/images/user_pic_add_75_75.png")" /></a>*@
                                    
                                }
                            </div>
                        </div>
                        <h4>
                            基本资料 <a id="edit" style="cursor: pointer; float: right;">编辑</a></h4>
                        <div class="tr">
                            <label class="lb">
                                <s>*</s><em>昵称:</em><span>@Html.DisplayFor(model => model.User.AccountName)</span></label>
                        </div>
                        <div class="tr">
                            <label class="lb">
                                <s>*</s><em>性别:</em><span>
                                    @if (Model.User.Gender.HasValue)
                                    {
                                        if (Model.User.Gender.Value == true)
                                        {
                                        <span>女</span>
                                        }
                                        else
                                        {
                                        <span>男</span>
                                        }
                                    }
@*@Html.DisplayFor(model => model.User.Gender)*@</span></label>
                        </div>
                        <div class="tr">
                            <label class="lb">
                                <s>*</s><em>出生年月:</em><span> @Html.DisplayFor(model => model.User.Birthday)</span></label>
                        </div>
                        <div class="tr">
                            <label class="lb">
                                <s>*</s><em>年龄:</em><span> @Html.DisplayFor(model => model.User.Age)</span></label>
                        </div>
                        <div class="tr">
                            <label class="lb">
                                <s>*</s><em>身高:</em><span> @Html.DisplayFor(model => model.User.Stature)</span></label>
                        </div>
                        <div class="tr">
                            <label class="lb">
                                <s>*</s><em>体重:</em><span> @Html.DisplayFor(model => model.User.Weight)</span></label>
                        </div>
                        <div class="tr">
                            <label class="lb">
                                <s>*</s><em>现居地:</em><span>@Html.DisplayFor(model => model.User.Location)</span></label>
                        </div>
                        <div class="tr">
                            <label class="lb">
                                <s>*</s><em>籍贯:</em><span>@Html.DisplayFor(model => model.User.NativePlace)</span></label>
                        </div>
                        <div class="tr">
                            <label class="lb">
                                <s>*</s><em>手机:</em><span>@Html.DisplayFor(model => model.User.Phone)</span></label><i>(不会公开给其他人，仅用于确认到场及现场联系)</i>
                        </div>
                        @if (Model.Party.PartyType == (int)DLM.Domain.Model.PartyType.Friend)
                        {
                            <div class="tr">
                                <label class="lb">
                                    <s>*</s><em>收入:</em><span>@Html.DisplayFor(model => model.User.Income)</span></label><i></i>
                            </div>
                            <div class="tr">
                                <label class="lb">
                                    <s>*</s><em>工作:</em><span>@Html.DisplayFor(model => model.User.Job)</span></label>
                            </div>
@*             <div class="tr">
                                <label class="lb">
                                    <s>*</s><em>房车:</em><span>
                                        @if (!string.IsNullOrEmpty(Model.User.Car))
                                        {
                                            <span>@Model.User.Car</span>
                                        }
                                    </span>
                                </label>
                                <i></i>
                            </div>*@
                            <div class="tr">
                                <label class="lb">
                                    <s>*</s><em>婚姻状况:</em><span>@Html.DisplayFor(model => model.User.Marriage)</span></label><i></i>
                            </div>            
@*          <div class="tr">
                                <label class="lb">
                                    <s>*</s><em>父母状况:</em><span>@Html.DisplayFor(model => model.User.Parents)</span></label><i></i>
                            </div>*@
                            <div class="tr">
                                <label class="lb">
                                    <s>*</s><em>学历:</em><span>@Html.DisplayFor(model => model.User.Education)</span></label><i></i>
                            </div>
            
                        }
                        <div class="tr">
                            <b>注：您的个人信息只能被提供了同等信息的会员看到。联系方式非索要并同意不可见。</b></div>
                        <div class="tr">
                            <div class="notice">
                                <span>参加此活动您将需要暂时扣15个积分（活动成功举办后后归还11个积分）。您目前的积分为：
                                    @if (Model.Bonus != null)
                                    {
                                        if (Model.Bonus.Bonuses.HasValue)
                                        {
                                        <a href="@Url.Action("UserCenter", "User")">@Model.Bonus.Bonuses.Value</a>
                                        }
                                    }
                                </span><a href="@Url.Action("Buy", "Trade")">充值</a></div>
                        </div>
                        <div class="tr">
                            <input id="chkAgree" name="chkAgree" type="checkbox" class="checkbox" />已仔细查看过并同意<a
                                href="#" id="open_service">《报名须知》</a></div>
                        <div class="hr">
                        </div>
                        <div class="tr">
                            @if (Model.Party.PartyType == (int)DLM.Domain.Model.PartyType.Friend)
                            {
                                if (!string.IsNullOrEmpty(Model.User.Photo) && Model.User.Photo != "none_75_75.png"
                                    && !string.IsNullOrEmpty(Model.User.Marriage) && !string.IsNullOrEmpty(Model.User.Education) && !string.IsNullOrEmpty(Model.User.Job)
                                    && !string.IsNullOrEmpty(Model.User.Location) && !string.IsNullOrEmpty(Model.User.NativePlace) && !string.IsNullOrEmpty(Model.User.Income)
                                    && !string.IsNullOrEmpty(Model.User.Phone) && !string.IsNullOrEmpty(Model.User.Weight.Value.ToString()) && !string.IsNullOrEmpty(Model.User.Stature))
                                {
                                    if (Model.User.Marriage != "已婚")
                                    {
                                        if (Model.Bonus != null)
                                        {
                                            if (Model.Bonus.Bonuses.HasValue && Model.Bonus.Bonuses.Value > 0)
                                            {
                                <input id="btnAttend" type="submit" value="" class="btn submit" /> 
                                            }
                                            else
                                            {
                                <a href="">您的积分不够，请充值后继续报名</a>
                                            }
                                        }
                                    }
                                    else
                                    {
                                <div class="tr clearfix">
                                    <div class="attention_2">
                                        已婚人士不允许参加单身男女活动</div>
                                </div>
                                    }


                                }
                                else
                                { 
                                <div class="tr clearfix">
                                    <div class="attention_2">
                                        请先在个人资料区域完善您的资料，才能继续报名参加活动</div>
                                </div>
                              
                                }
                            }
                            else
                            {
                                if (!string.IsNullOrEmpty(Model.User.Phone))
                                {
                                    if (Model.Bonus != null)
                                    {
                                        if (Model.Bonus.Bonuses.HasValue && Model.Bonus.Bonuses.Value > 0)
                                        {
                                <input id="btnAttend" type="submit" value="" class="btn join_party" /> 
                                        }
                                        else
                                        {
                                <a href="">您的积分不够，请充值后继续报名</a>
                                
                                
                                        }
                                    }
                                }
                                else
                                {
                                <div class="tr clearfix">
                                    <div class="attention_2">
                                        请先在个人资料区域完善您的资料，才能继续报名参加活动</div>
                                </div>
                                }


                            }
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
}
